﻿//-----------------------------------------------------------------------
// <copyright file="Preferences.cs" company="Craig Longford (deltawolf7@gmail.com)">
//     Copyright (c) Craig Longford. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Delta.Mercury.Business.User
{
    using System;
    using Delta.Data.DataExpress;

    /// <summary>
    /// Collection of user preferences
    /// </summary>
    [Serializable]
    public class Preferences
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the Preferences class.
        /// </summary>
        public Preferences()
        {
        }
        #endregion

        #region Load Methods
        /// <summary>
        /// Load preferences of a user
        /// </summary>
        /// <param name="user">User to load the preferences of</param>
        /// <returns>Colelction of preferences</returns>
        public static Preferences Load(IUser user)
        {
            Parameters parameters = new Parameters();
            parameters.Add(new Parameter("UserGuid", user.Guid));
            return DataAccess.GetCollection<Preferences, Preference>("LoadPreferences", System.Data.CommandType.StoredProcedure, parameters);
        }
        #endregion
    }
}
